OPC Studio User's Guide and Reference
Shared Instance
Fundamentals > OPC Data Client Fundamentals > OPC Data Client Data Model > OPC Data Client Communication Objects > Shared Instance

Instead of explicitly instantiating the EasyDAClient (or EasyAEClient, EasyUAClientEasyUASubcriber) objects, you can also use a single, pre-made instance of it, resulting in shorter code. You can access it as a SharedInstance static property on the class, and it contains a default, shared instance of the client object.

Use this property with care, as its usability for larger projects is limited. Its main use is for testing and for non-library application code where just a single instance is sufficient.

If you plan to use events on the EasyXXClient or EasyXXSubscriber component, the shared instance is not suitable for Windows Forms, WPF or similar environments, where a specific SynchronizationContext may be used with each form.

We also do not recommend using the shared instance for library code (if you are developing a Class Library project), due to conflicts that may arise if your library sets some instance parameters which may not be the same as what other libraries or the final application expect.

In OPC Data Client-COM, you can access the shared instance through the EasyXXClientConfiguration (or EasyXXSubscriberConfiguration) object.

See Also